package cc.geguol.statement;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * Created by 13687 on 2017/2/11.
 */
public class DDLDemo {
	private String uri="jdbc:mysql://localhost:3306/student";
	private String user = "root";
	private String pwd = "root";
	private Connection conn;
	private Statement stmt;//连接

	/**
	 * @throws ClassNotFoundException
	 * ddl 创建表
	 *
	 */
	private void test() throws ClassNotFoundException, SQLException {
		Class.forName("com.mysql.jdbc.Driver");
		conn = DriverManager.getConnection(uri,user,pwd);

//		3、创建statement
		stmt=conn.createStatement();
//		4、执行语句
		String sql = "CREATE table student(id int primary key AUTO_INCREMENT,name varchar(20),gender varchar(2))";
		stmt.executeUpdate(sql);


	}
}
